﻿using System;
using System.Collections.Generic;
using System.Text;
using Barbar.MapReport.Common;

namespace Barbar.MapReport.DataSource.Facade {
  public class RegionRequestById : RegionRequest {
    private string m_RegionId;
    private int m_GoogleZoomLevel = ZoomLevelCollection.MaxGoogleZoomLevel;
    private bool m_IncludeGeoBound;

    public string RegionId {
      get { return m_RegionId; }
      set { m_RegionId = value; }
    }

    public int GoogleZoomLevel {
      get { return m_GoogleZoomLevel; }
      set { m_GoogleZoomLevel = value; }
    }

    public bool IncludeGeoBound {
      get { return m_IncludeGeoBound; }
      set { m_IncludeGeoBound = value; }
    }

    internal override RegionResponse GetResponse() {
      SingleRegionResponse response = new SingleRegionResponse();
      response.Region = new SimpleRegion(DataSourceManager.GetRegionById(RegionId));
      if (m_IncludeGeoBound) {
        ZoomLevel zoomLevel = DataSourceManager.ZoomLevels.GetZoomLevel(ZoomLevelCollection.MaxGoogleZoomLevel);
        response.GeoBound = new GeoBound(DataSourceManager.GetRegionGeometry(RegionId, zoomLevel));
      }
      return response;
    }
  }
}
